package com.mybatis.dao;

import com.mybatis.pojo.Student;
import com.mybatis.util.mybatisUtil;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.sql.SQLOutput;
import java.util.List;

public class Mytext {
    public static void main(String[] args) {
        SqlSession sqlSession = mybatisUtil.getSqlSession();
        TeacherMapper mapper = sqlSession.getMapper(TeacherMapper.class);
        TeacherMapper teacher = mapper.getTeacher(0);
        System.out.println(teacher);
        sqlSession.close();
}
    @Test
    public void getStudent(){
        SqlSession sqlSession = mybatisUtil.getSqlSession();
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        List<Student> studentList= mapper.getStudent();
        for (Student student: studentList) {
            System.out.println(student);
        }
        sqlSession.close();
    }

}



//
